<script>
	import http from "./common/js/request.js"
		var theapp = this;
	export default {
		globalData: {
			baseImgUrl: 'https://static.mback.xyz',
			qrcodeBaseUrl: 'https://demo.fastadmin.net/qrcode/build?text=',
			canvasShareBaseUrl: 'https://store.qidian2018.com/index.php?mode=wx_qrcode&type=give_goods&',
			storeId: 1, //店铺
			deskId: 0, //桌号
			choosePeopleCount: false, //是否已选用餐人数
			init(callback) {
				var that=this;
				// // var key = uni.getStorageSync('key') || '';
				var key =getApp().globalData.key || '';
				console.log(key)
				if (key) {
					typeof callback == 'function' ? callback() : '';
				} else {
					uni.login({
						success(res) {
							if (res.code) {
								var api = "/api/v1/login/index_wx";
								http.post(api, {
									js_code: res.code,
								}, (res) => {
									// uni.setStorageSync('key', res.datas.key);
									getApp().globalData.key=res.datas.key
									typeof callback == 'function' ? callback() : '';
								});
							} else {
								console.log('登录失败！' + res.errMsg)
							}
						}
					});
				}
			}
		},
		onLaunch: function() {

		},

	}
</script>

<style>
	/*每个页面公共css */
	view,
	text {
		font-size: #2C2C2C;
	}

	.container {
		height: 100%;
		display: flex;
		flex-direction: column;
		overflow: hidden;
	}

	.row {
		display: flex;
		flex-direction: row;
	}

	.col {
		display: flex;
		flex-direction: column;
	}

	.auto-left {
		margin-left: auto;
	}

	.theme-bg-color {
		background: #FF9D11 !important;
	}

	.theme-font-color {
		color: #FF9D11 !important;
	}

	.theme-border {
		border: 1rpx solid #73b746;
	}

	.margin {
		margin: 0rpx 20rpx;
	}

	.padding {
		padding: 0rpx 20rpx;
	}

	.status {
		font-size: 28rpx;
	}

	/* 文字超出省略 */

	.text-ellipsis {
		overflow: hidden;
		text-overflow: ellipsis;
		white-space: nowrap;
	}

	/*  弹窗遮罩 */
	.mask {
		width: 100%;
		height: 100%;
		position: fixed;
		background-color: #000;
		z-index: 997;
		top: 0;
		left: 0;
		-moz-opacity: 0.4;
		opacity: 0.40;
		filter: alpha(opacity=40);
	}

	/* 清除button默认样式 */
	button {
		background: none;
	}

	.button-hover {
		background: none;
	}

	button::after {
		border: none;
	}

	input {
		outline: none;
		border: none;
		list-style: none;
	}

	.page-config-tips {
		color: #666;
		font-size: 24rpx;
		height: 24rpx;
		margin: 20rpx 0rpx;
		display: flex;
		align-items: center;
		justify-content: center;
	}

	.overflow {
		overflow: hidden;
		white-space: nowrap;
		text-overflow: ellipsis;
	}

	.overflow-row {
		overflow: hidden;
		text-overflow: ellipsis;
		display: -webkit-box;
		-webkit-line-clamp: 2;
		-webkit-box-orient: vertical;
	}

	.mode {
		text-align: center;
		font-size: 28rpx;
		line-height: 86rpx;
		height: 86rpx;
	}

	/* 分页器样式 */

	.paginate {
		display: flex;
		flex-direction: row;
		justify-content: center;
		align-items: center;
		color: #848484;
		font-size: 30rpx;
	}

	.paginate text {
		height: 67rpx;
		line-height: 67rpx;
		text-align: center;
	}
</style>
